package com.tomehay.termprojectmanage_server.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;

import com.tomehay.termprojectmanage_server.pojo.Model.Clazz;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author tomehay
 * @since 2023-06-20
 */
public interface ClazzMapper extends BaseMapper<Clazz> {
    @Select("SELECT MAX(student.student_no) WHERE student.clazz_id = #{id}")
    int findNextNo(int id);

    List<Clazz> selectAllById(@Param("id") Integer id);

    Clazz selectOneById(@Param("id") Integer id);

    @Select("SELECT clazz.* from clazz,course_clazz WHERE course_clazz.course_id = #{course_id} AND clazz.id = course_clazz.clazz_id")
    List<Clazz> findClazzByCourseId(int course_id);
}
